import ATM.UserInfo;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.HashMap;

public class CreateData {
    public static void main(String[] args) {
        HashMap<String, UserInfo> allUsers = new HashMap<>();

        UserInfo user1 = new UserInfo("zhang3", "123456", 10000);
        UserInfo user2 = new UserInfo("li4", "123456", 10000);
        UserInfo user3 = new UserInfo("wang5", "123456", 10000);
        UserInfo user4 = new UserInfo("zhao6", "123456", 10000);

        allUsers.put("zhang3", user1);
        allUsers.put("li4", user2);
        allUsers.put("wang5", user3);
        allUsers.put("zhao6", user4);

        try (FileOutputStream fos = new FileOutputStream("user.data");
             ObjectOutputStream oos = new ObjectOutputStream(fos)) {
            oos.writeObject(allUsers);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
